set(src_lib
    algo/anubis.c
    algo/cast6.c
    algo/rc6.c
    algo/ripemd.c
    algo/twofish.c
    algo/serpent.c
    algo/sha1.c
    algo/sha2.c
    algo/sha3.c
    algo/threefish.c
    kdf/kdf2.c
    mode/ecb.c
    mode/cbc.c
    mode/hmac.c
    mode/ofb.c
    akmos.c
    cipher.c
    digest.c
    mac.c)

set(src_cli
    cli/main.c
    cli/cipher.c
    cli/digest.c)

list(SORT src_lib)
list(SORT src_cli)

add_definitions(-D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L)
add_library(akmos_obj OBJECT ${src_lib})

add_library(akmos_shared SHARED $<TARGET_OBJECTS:akmos_obj>)
set_target_properties(akmos_shared PROPERTIES VERSION 0.1 SOVERSION 0 OUTPUT_NAME akmos)

add_library(akmos_static STATIC $<TARGET_OBJECTS:akmos_obj>)
set_target_properties(akmos_static PROPERTIES OUTPUT_NAME akmos)

add_executable(akmos ${src_cli})
target_link_libraries(akmos akmos_shared)

set(BINDIR bin)

install(TARGETS akmos_shared akmos_static akmos
        LIBRARY DESTINATION lib
        ARCHIVE DESTINATION lib
        RUNTIME DESTINATION bin)
install(FILES akmos.h
        DESTINATION include)
